package stats

import (
	"Hypnos-Soundcore/components/helper"
	"github.com/gin-gonic/gin"
	"time"
)

// Stats record latency for every request
func Stats() gin.HandlerFunc {
	return func(c *gin.Context) {
		// Start timer
		start := time.Now()
		// Process request
		c.Next()
		helper.PrintRequestLatency(start, c)
	}
}
